package com.hk.web.domain.entity;

import com.hk.commons.domain.entity.IdEntity;
import com.hk.commons.enums.UploadFiLeType;
import com.hk.commons.enums.UploadStatus;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 * Created by Antinomy on 16/12/14.
 */
@Entity
@DynamicInsert
@DynamicUpdate
@EntityListeners(AuditingEntityListener.class)
public class UploadFile extends IdEntity {

    @Column(columnDefinition = "varchar(50) NOT NULL UNIQUE comment '唯一识别码'")
    private String uuid;

    @Column(columnDefinition = "varchar(50) comment '文件名'")
    private String name;

    @Column(columnDefinition = "varchar(50) comment '文件七牛 hash值'")
    private String hash;

    @Column(columnDefinition = "varchar(50) comment '文件md5 hash值'")
    private String md5;

    @Column(columnDefinition = "varchar(50) NOT NULL comment '上传状态 (DONE(\"已上传\"),FAILED(\"上传失败\"),NOT_YET(\"未上传\")'")
    @Enumerated(EnumType.STRING)
    private UploadStatus status= UploadStatus.NOT_YET;

    @Column(columnDefinition = "varchar(50) NOT NULL comment '上传文件类型 (UNKNOWN(\"未知类型\"),IMAGE(\"图片\"),VIDEO(\"视频\")'")
    @Enumerated(EnumType.STRING)
    private UploadFiLeType type= UploadFiLeType.UNKNOWN;

    @Column(columnDefinition = "varchar(255)  comment '文件url'")
    private String url;

    @Column(columnDefinition = "varchar(255)  comment '上传结果返回消息'")
    private String respMsg;

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getHash() {
        return hash;
    }

    public void setHash(String hash) {
        this.hash = hash;
    }

    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        this.md5 = md5;
    }

    public UploadStatus getStatus() {
        return status;
    }

    public void setStatus(UploadStatus status) {
        this.status = status;
    }

    public UploadFiLeType getType() {
        return type;
    }

    public void setType(UploadFiLeType type) {
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getRespMsg() {
        return respMsg;
    }

    public void setRespMsg(String respMsg) {
        this.respMsg = respMsg;
    }
}
